package com.maxatime.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.maxatime.dao.kaoshi2Mapper;
import com.maxatime.pojo.dto.kaoshi2DTO;
import com.maxatime.pojo.entity.kaoshi2;
import com.maxatime.service.Ssbkaoshi3;


@Service
public class SsbkaoshiImpl3 implements Ssbkaoshi3{
	
	@Autowired
	kaoshi2Mapper kaoshi2Mapper;
	
	//查询
	@Override
	public Map<String, Object> listdate(kaoshi2 kaoshi) {
		// TODO Auto-generated method stub
		
		PageHelper.startPage(kaoshi.getPageNum(), kaoshi.getPageSize());
		
		List<kaoshi2> listDemo = kaoshi2Mapper.listdate(kaoshi);
		
		PageInfo<kaoshi2> pageInfo = new PageInfo<kaoshi2>(listDemo);
		Map<String, Object> m = new HashMap<String, Object>();
		m.put("list", listDemo);
		m.put("pageInfo", pageInfo);
		return m;
	}

	@Override
	public int deleteByPrimaryKey(Integer pkid) {
		// TODO Auto-generated method stub
		return kaoshi2Mapper.deleteByPrimaryKey(pkid);
	}

	@Override
	public int insert(kaoshi2 record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(kaoshi2 record) {
		// TODO Auto-generated method stub
		Date d = new Date();
		kaoshi2 kaoshi2 =new kaoshi2();
		BeanUtils.copyProperties(record, kaoshi2);
		kaoshi2.setCreateTime(d);
		kaoshi2.setUpdateTime(d);
		kaoshi2.setDeleteFlag("0");
		kaoshi2Mapper.insertSelective(kaoshi2);
		return 0;
	}

	@Override
	public kaoshi2 selectByPrimaryKey(Integer pkid) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public kaoshi2 updateByPrimaryKeySelective(kaoshi2 record) {
		// TODO Auto-generated method stub
		kaoshi2 kaoshi2 = new kaoshi2();
		BeanUtils.copyProperties(record, kaoshi2);
		Date d = new Date();
		kaoshi2.setUpdateTime(d);
		return kaoshi2Mapper.updateByPrimaryKeySelective(kaoshi2);
	}

	@Override
	public int updateByPrimaryKey(kaoshi2 record) {
		// TODO Auto-generated method stub
		return 0;
	}
	//反显
	@Override
	public kaoshi2 findpkid(int pkid) {
		// TODO Auto-generated method stub
		return kaoshi2Mapper.findpkid(pkid);
	}
	//查询bzt
	@Override
	public List<kaoshi2> list(kaoshi2 kaoshi2) {
		// TODO Auto-generated method stub
		List<kaoshi2> list = kaoshi2Mapper.list(kaoshi2);
		return list;
	}
	

}
